#include "inc.h"

PUBLIC int initSocket(int *sd, struct sockaddr_in saddr){

	int flg;
	
	if((*sd = socket(AF_INET, SOCK_STREAM,0)) < 0){
		fprintf(stderr,"Socket create failure:%d\n", errno);
		return(ERROR);
	}

	if((flg = bind(*sd,(struct sockaddr *)&saddr,sizeof(saddr)))<0){
		fprintf(stderr,"Socket bind failure:%d\n", errno);
		return(ERROR);
	}
	
	printf("HELLO FROM INITSOCKET\n");
	if((flg = listen(*sd,CLIENT_Q))<0){
		fprintf(stderr,"Socket listen failure:%d\n", errno);
		return(ERROR);
	}

}
